package com.moxiao.yfjh.module.system.controller.app.memmessage;

import com.moxiao.yfjh.framework.common.pojo.CommonResult;
import com.moxiao.yfjh.module.system.controller.app.memmessage.vo.AppMemMessageCreateReqVO;
import com.moxiao.yfjh.module.system.convert.memmessage.MemMessageConvert;
import com.moxiao.yfjh.module.system.service.memmessage.MemMessageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

import static com.moxiao.yfjh.framework.common.pojo.CommonResult.success;

@Tag(name = "用户 APP - 聊天记录")
@RestController
@RequestMapping("/system/mem-message")
@Validated
public class AppMemMessageController {
    @Resource
    private MemMessageService memMessageService;

    @PostMapping("/addMemMessage")
    @Operation(summary = "创建聊天记录")
    public CommonResult<Integer> addMemMessage(@Valid @RequestBody AppMemMessageCreateReqVO appMemMessageCreateReqVO) {
        return success(memMessageService.createMemMessage(MemMessageConvert.INSTANCE.convert(appMemMessageCreateReqVO)));
    }

}
